
const app = getApp()

Component({
  properties: {
    title: {
      type: String,
      value: '桌号',
    },
    btnText: {
      type: String,
      value: '确定',
    },
    tabCount:{
      type:Number,
      value:30,
    }
  },

  data: {
    currentNum: 0,
    tabNumShow: false,
    tabNums: [],
    tabNumIndex: null,
    wrapAnimate: 'wrapAnimate',
  },
  lifetimes: {
    attached: function () {
    },
  },
  methods: {
    isShowClick() {
      this.data.tabNumShow = true
      if (app.DESK_TYPE==1) {
        this.data.tabNumIndex = 0;
      }
      this.setData({
        tabNumIndex:this.data.tabNumIndex,
        tabNumShow: this.data.tabNumShow
      })
      wx.setPageStyle({
        style: {
           overflow: 'hidden'
        }
     })
    },
    closetabNum() {
      this.data.tabNumShow = false
      this.setData({
        tabNumShow: this.data.tabNumShow
      })
      wx.setPageStyle({
        style: {
           overflow: ''
        }
     })
    },
    tabNumClick(e) {

      if (this.data.tabNumIndex == e.currentTarget.dataset.index) {
        this.data.tabNumIndex = null
      }
      else {
        this.data.tabNumIndex = e.currentTarget.dataset.index
      }
      this.setData({
        tabNumIndex: this.data.tabNumIndex,
      })
    },
    confirmTap() {
      const that = this
      this.triggerEvent('tabNumbresChange',{tabNum:that.data.tabNumIndex})
      this.data.tabNumShow  = false
      this.setData({
        tabNumShow: this.data.tabNumShow
      })
    }
  },

})
